/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package project.jpdftools.ui.logic;

import com.itextpdf.text.Document;
import javax.swing.*;
import project.jpdftools.ui.actionlisteners.RemoveComponentAction;
import project.jpdftools.managers.LocalizationManager;

/**
 *
 * @author Mido
 */
public abstract class JPDF {

    private int id;
    // UI components
    protected JPanel panel = new JPanel();
    protected JRadioButtonMenuItem miAlignLeft = new JRadioButtonMenuItem(LocalizationManager.getCurrent_resource().getString("JPDF_ALIGN_LEFT"),
            new ImageIcon("Data/Icons/Menu Items/text_align_left.gif"));
    protected JRadioButtonMenuItem miAlignRight = new JRadioButtonMenuItem(LocalizationManager.getCurrent_resource().getString("JPDF_ALIGN_RIGHT"),
            new ImageIcon("Data/Icons/Menu Items/text_align_right.gif"));
    protected JRadioButtonMenuItem miAlignCenter = new JRadioButtonMenuItem(LocalizationManager.getCurrent_resource().getString("JPDF_ALIGN_CENTER"),
            new ImageIcon("Data/Icons/Menu Items/text_align_center.gif"));
    protected JMenuItem miRemoveComponent = new JMenuItem(LocalizationManager.getCurrent_resource().getString("JPDF_REMOVE_COMPONENT"),
            new ImageIcon("Data/Icons/Menu Items/Remove.png"));
    protected JPopupMenu menu = new JPopupMenu();
    protected JMenu mTextAlignment = new JMenu(LocalizationManager.getCurrent_resource().getString("JPDF_TEXT_ALIGNMENT"));
    protected JScrollPane scrollPane;

    public JPDF() {
        // action listeners for components
        miRemoveComponent.addActionListener(new RemoveComponentAction(this));
    }

    /**
     * export certain JPDF component to pdf file.
     */
    public abstract void export(Document document);

    /**
     * create user interface of the component.
     */
    public abstract void createUI();

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public JScrollPane getScrollPane() {
        return scrollPane;
    }

    public JPopupMenu getMenu() {
        return menu;
    }

    public JRadioButtonMenuItem getMiAlignCenter() {
        return miAlignCenter;
    }

    public JRadioButtonMenuItem getMiAlignLeft() {
        return miAlignLeft;
    }

    public JRadioButtonMenuItem getMiAlignRight() {
        return miAlignRight;
    }

    public JMenuItem getMiRemoveComponent() {
        return miRemoveComponent;
    }

    public JPanel getPanel() {
        return panel;
    }
}
